// @ts-ignore
import React from 'react';
import {BrowserRouter as Router, Route, Routes} from 'react-router-dom';
import HomePage from './pages/HomePage';
import CategoryPage from './components/CategoryPage';
import DetailPage from './pages/DetailPage';
import ProfilePage from './pages/ProfilePage';
import MyTrainingsPage from './pages/MyTrainingsPage';
import OrganizedTrainingsPage from './pages/OrganizedTrainingsPage';
import MyMedalsPage from './pages/MyMedalsPage';
import BrowseHistoryPage from './pages/BrowseHistoryPage';
import AdminLayout from './pages/admin/AdminLayout';
import AdminDashboard from './pages/admin/AdminDashboard';
import AdminCategories from './pages/admin/AdminCategories';
import AdminTrainings from './pages/admin/AdminTrainings';
import AdminUsers from './pages/admin/AdminUsers';
import AdminComments from './pages/admin/AdminComments';
import AdminSettings from './pages/admin/AdminSettings';
import AdminMediaLibrary from './pages/admin/AdminMediaLibrary';
import AdminTrainingOrders from './pages/admin/AdminTrainingOrders';
import AdminRoles from './pages/admin/AdminRoles';
import AdminMedals from './pages/admin/AdminMedals';
import Login from './pages/admin/Login';

export default function App() {
  return (
    <Router>
      <Routes>
        <Route path="/" element={<Login/>}/>
        <Route path="/mobile" element={<HomePage/>}/>
        <Route path="/category/:categoryId" element={<CategoryPage/>}/>
        <Route path="/detail/:id" element={<DetailPage/>}/>
        <Route path="/profile" element={<ProfilePage/>}/>
        <Route path="/my-trainings" element={<MyTrainingsPage/>}/>
        <Route path="/organized-trainings" element={<OrganizedTrainingsPage/>}/>
        <Route path="/my-medals" element={<MyMedalsPage/>}/>
        <Route path="/browse-history" element={<BrowseHistoryPage/>}/>
        
        {/* 后台管理路由 */}
        <Route path="/admin" element={<AdminLayout />}>
          <Route index element={<AdminDashboard />} />
          <Route path="categories" element={<AdminCategories />} />
          <Route path="categories/:categoryId" element={<AdminCategories />} />
          <Route path="trainings" element={<AdminTrainings />} />
          <Route path="trainings/new" element={<AdminTrainings />} />
          <Route path="users" element={<AdminUsers />} />
          <Route path="comments" element={<AdminComments />} />
          <Route path="settings" element={<AdminSettings />} />
          <Route path="media" element={<AdminMediaLibrary />} />
          <Route path="training-orders" element={<AdminTrainingOrders />} />
          <Route path="roles" element={<AdminRoles />} />
          <Route path="medals" element={<AdminMedals />} />
        </Route>
      </Routes>
    </Router>
  );
}